home *** CD-ROM | disk | FTP | other *** search
- /*LINTLIBRARY*/
-
- /* @(#)tty.c 1.21 91/11/13
- *
- * These are the dumb tty dependent graphics routines used by reve.
- *
- * Copyright (C) 1990, 1991 - Rich Burridge & Yves Gallot.
- * All rights reserved.
- *
- * Permission is granted to copy this source, for redistribution
- * in source form only, provided the news headers in "substantially
- * unaltered format" are retained, the introductory messages are not
- * removed, and no monies are exchanged.
- *
- * Permission is also granted to copy this source, without the
- * news headers, for the purposes of making an executable copy by
- * means of compilation, provided that such copy will not be used
- * for the purposes of competition in any othello tournaments, without
- * prior permission from the authors.
- *
- * No responsibility is taken for any errors or inaccuracies inherent
- * either to the comments or the code of this program, but if reported
- * (see README file), then an attempt will be made to fix them.
- */
-
- #include "reve.h"
- #include "color.h"
- #include "extern.h"
- #include <sys/ioctl.h>
- #include <signal.h>
-
- #ifdef HASPOLL
- #include <poll.h>
- #endif /*HASPOLL*/
-
- #ifdef SYSV
- #include <sgtty.h>
- #endif /*SYSV*/
-
- #define DRAW_STRING(col, row, str, v) draw_string(col, row, str, v), return
-
- #define KEY_INPUT 0 /* Types of input selected on. */
- #define COMP_INPUT 1
- #define SOCK_INPUT 2
-
- enum gr_type gtype = GTTY ; /* Graphics type. */
-
- #ifdef NOSELECT
- #ifdef HASPOLL
- struct pollfd pfd[2] ;
- unsigned long npfd ; /* Number of file descriptors to monitor. */
- #endif /*HASPOLL*/
- #else NOSELECT
- #ifdef NO_43SELECT
- int fullmask ; /* Full mask of file descriptors to check on. */
- int readmask ; /* Readmask used in select call. */
- #else
- fd_set fullmask ; /* Full mask of file descriptors to check on. */
- fd_set readmask ; /* Readmask used in select call. */
- #endif /*NO_43SELECT*/
- #endif /*NOSELECT*/
-
- /* NOTE: This is a classic example of reverse engineering. These routines
- * have been modified (read hacked), to use the same interface as
- * the pixel graphics ones. Therefore they have to do some strange
- * checking to make sure everything comes out correctly.
- */
-
- char *CE, *CL, *CM, *SE, *SO ;
-
- extern char *getenv P((char *)) ;
- extern char *tgetstr P((char *, char **)) ;
- extern char *tgoto P((char *, int, int)) ;
-
- struct sgttyb in_new, in_old ;
-
- static void do_clr_eol P(()) ;
- static void do_standend P(()) ;
- static void do_standout P(()) ;
- static void draw_string P((int, int, char *, int)) ;
- static void get_event P(()) ;
- static void outc P((int)) ;
- static void outstr P((char *)) ;
- static void tc_move P((int, int)) ;
-
- /* Information for all the panel items. */
-
- struct tty_info { /* Information for all the panel items. */
- int column ; /* Column number. */
- int row ; /* Row number. */
- int x ; /* Pseudo x mouse position. */
- int y ; /* Pseudo y mouse position. */
- } ;
-
- struct tty_info ttyvals[MAXITEMS] = {
- { 1, 1, 43, 32, }, /* Load */
- { 11, 1, 117, 32, }, /* Moves? */
- { 22, 1, 191, 32, }, /* New game */
- { -1, -1, 265, 32, }, /* Help (not displayed). */
- { -1, -1, 339, 32, }, /* Redo (not displayed). */
- { -1, -1, 413, 32, }, /* Props (not displayed). */
- { 33, 1, 43, 74, }, /* Save */
- { 44, 1, 117, 74, }, /* Suggest */
- { -1, -1, 191, 74, }, /* Print (not displayed). */
- { -1, -1, 265, 74, }, /* Stop (not displayed). */
- { 55, 1, 339, 74, }, /* Undo */
- { -1, -1, 339, 74, }, /* Cancel (not displayed). */
- { -1, -1, 413, 74, }, /* Quit (not displayed). */
- { 45, 5, 15, 111, }, /* Black: */
- { 45, 7, 237, 111, }, /* White: */
- { -1, -1, -1, -1, }, /* Black clock. */
- { -1, -1, -1, -1, }, /* White clock. */
- { -1, -1, -1, -1, }, /* Panel message. */
- { -1, -1, -1, -1, }, /* Notes message. */
- { -1, -1, -1, -1, }, /* Score message. */
- { -1, -1, -1, -1, }, /* Turn message. */
- { -1, -1, -1, -1, }, /* Computer choice.: */
- { -1, -1, -1, -1, }, /* Difficulty. */
- { -1, -1, -1, -1, }, /* Maximum search depth. */
- { -1, -1, -1, -1, }, /* Animate option: */
- { -1, -1, -1, -1, }, /* Best computer move option. */
- { -1, -1, -1, -1, }, /* Last move option. */
- { -1, -1, -1, -1, }, /* Show evaluation option. */
- { -1, -1, -1, -1, }, /* Number move option. */
- { -1, -1, -1, -1, }, /* Quick game option. */
- { -1, -1, -1, -1, }, /* Display clocks. */
- { -1, -1, -1, -1, }, /* Help window page cycle.*/
- } ;
-
- struct other_info { /* Information needed to place other text values. */
- int column ; /* Column number. */
- int row ; /* Row number. */
- } ;
-
- struct other_info othervals[MAXITEMS] = {
- { -1, -1, }, /* Load (ignored). */
- { -1, -1, }, /* Moves? (ignored). */
- { -1, -1, }, /* New game (ignored). */
- { -1, -1, }, /* Help (ignored). */
- { -1, -1, }, /* Redo (ignored). */
- { -1, -1, }, /* Props (ignored). */
- { -1, -1, }, /* Save (ignored). */
- { -1, -1, }, /* Suggest (ignored). */
- { -1, -1, }, /* Print (ignored). */
- { -1, -1, }, /* Stop (ignored). */
- { -1, -1, }, /* Undo (ignored). */
- { -1, -1, }, /* Cancel (ignored). */
- { -1, -1, }, /* Quit (ignored). */
- { 38, 5, }, /* Black: */
- { 38, 7, }, /* White: */
- { 60, 5, }, /* Black clock. */
- { 60, 7, }, /* White clock. */
- { 38, 13, }, /* Panel message. */
- { 38, 15, }, /* Notes message. */
- { 38, 17, }, /* Score message. */
- { 38, 19, }, /* Turn message. */
- { -1, -1, }, /* Computer choice. */
- { 60, 9, }, /* Difficulty. */
- { -1, -1, }, /* Maximum search depth. */
- { -1, -1, }, /* Animate option: */
- { -1, -1, }, /* Best computer move option. */
- { -1, -1, }, /* Last move option. */
- { 60, 11, }, /* Show evaluation option. */
- { -1, -1, }, /* Number move option. */
- { -1, -1, }, /* Quick game option. */
- { -1, -1, }, /* Display clocks. */
- { -1, -1, }, /* Help window page cycle. */
- } ;
-
-
- /*ARGSUSED*/
- void
- batch(state) /* Graphics batching - null routine. */
- enum bltype state ;
- {}
-
-
- void
- beep()
- {
- }
-
-
- void
- close_reve()
- {
- }
-
-
- SIGRET
- cleanup()
- {
- destroy_reve() ;
- }
-
-
- void
- connect_io() /* Connect to keyboard, computer process and remote human. */
- {
- #ifdef NOSELECT
- #ifdef HASPOLL
- npfd = 0L ;
- pfd[0].fd = pfd[1].fd = pfd[2].fd = -1 ;
- pfd[0].events = pfd[1].events = pfd[2].events = POLLIN ;
- pfd[0].fd = 0, npfd++ ; /* Keyboard. */
- if (pipe_io[1][0] > 0) pfd[1].fd = pipe_io[1][0], npfd++ ; /* Computer. */
- if (socketfd > 0) pfd[2].fd = socketfd, npfd++ ; /* Human. */
- #endif /*HASPOLL*/
- #else
- #ifdef NO_43SELECT
- fullmask = 0 ;
- fullmask |= (1 << 0) ; /* Keyboard. */
- if (pipe_io[1][0] > 0) fullmask |= (1 << pipe_io[1][0]) ; /* Computer. */
- if (socketfd > 0) fullmask |= (1 << socketfd) ; /* Human. */
- #else
- FD_ZERO(&fullmask) ;
- FD_SET(0, &fullmask) ; /* Keyboard. */
- if (pipe_io[1][0] > 0) FD_SET(pipe_io[1][0], &fullmask) ; /* Computer. */
- if (socketfd > 0) FD_SET(socketfd, &fullmask) ; /* Human. */
- #endif /*NO_43SELECT*/
- #endif /*NOSELECT*/
- }
-
-
- /*ARGSUSED*/
- void
- color_area(wtype, x, y, width, height, color)
- enum win_type wtype ;
- int x, y, width, height, color ;
- {
- char nextline[MAXLINE] ;
-
- /* There are two cases we care about here:
- *
- * (1) If the width is TOTAL_WIDTH and the height is TOTAL_HEIGHT, then
- * we clear the whole of the screen. We also draw the board at this
- * time. With the pixel based graphics versions, this is normally
- * done by low-level graphics routines, but to fully emulate that is
- * just too hard.
- *
- * (2) When we are "undo"ing a piece. A check is made to if the width and
- * the height of the area we are coloring is PSIZE. If so, then we
- * display a space at the appropriately adjusted row/column.
- */
-
- if (width == BOARD_DIM && height == BOARD_DIM)
- {
- tputs(CL, 1, outc) ;
- tc_move(4, 3) ;
- outstr("a b c d e f g h") ;
- for (y = 4; y < 21; y++)
- {
- tc_move(1, y) ;
- if (y % 2)
- SPRINTF(nextline, "%c| | | | | | | | |%c",
- '1' + (y - 4) / 2, '1' + (y - 4) / 2) ;
- else SPRINTF(nextline, " +---+---+---+---+---+---+---+---+") ;
- outstr(nextline) ;
- }
- tc_move(4, 21) ;
- outstr("a b c d e f g h") ;
- }
- else if (width == PSIZE && height == PSIZE)
- {
- tc_move(4 + 4 * (((x - BBORDER - PIECE_MARGIN) / CELL_SIZE) & 7),
- 5 + 2 * ((y - BBORDER - PIECE_MARGIN) / CELL_SIZE)) ;
- outc(' ') ;
- }
- }
-
-
- void
- destroy_reve() /* Terminate Reve. */
- {
- KILL(pid, SIGKILL) ;
- tputs(CL, 1, outc) ;
- SIGNAL(SIGINT, SIG_IGN) ;
- IOCTL(0, TIOCSETP, &in_old) ;
- exit(0) ;
- }
-
-
- static void
- do_clr_eol() /* Clear to the end of the line. */
- {
- tputs(CE, 1, outc) ;
- }
-
-
- static void
- do_standend() /* Finish inverted area. */
- {
- tputs(SE, 1, outc) ;
- }
-
-
- static void
- do_standout() /* Start inverted area. */
- {
- tputs(SO, 1, outc) ;
- }
-
-
- /*ARGSUSED*/
- void
- draw_image(wtype, x, y, width, height, image) /* Null routine. */
- enum win_type wtype ;
- int x, y, width, height ;
- enum image_type image ;
- {}
-
-
- /*ARGSUSED*/
- void
- draw_line(wtype, x1, y1, x2, y2, op, color)
- enum win_type wtype ;
- int x1, y1, x2, y2, color ;
- enum optype op ;
- {
- char ch ;
-
- /* There is just one case we care about here; the "suggest" cross. To
- * determine if this is such a case, we check if the two x values differ
- * by 10, and the two y values differ by 10. If so, then a plus sign is
- * output at the appropriate row/column, if the color is black, otherwise
- * a space is output.
- */
-
- if (abs(x1 - x2) == 10 && abs(y1 - y2) == 10)
- {
- ch = '+' ;
- tc_move(4 + 4 * (((x1 - BBORDER - PIECE_MARGIN) / CELL_SIZE) & 7),
- 5 + 2 * ((y1 - BBORDER - PIECE_MARGIN) / CELL_SIZE)) ;
- if (color != C_BLACK) ch = ' ' ;
- outc(ch) ;
- }
- }
-
-
- /*ARGSUSED*/
- void
- draw_stencil(wtype, x, y, width, height, op, color, stencil, image)
- enum win_type wtype ;
- int x, y, width, height, color ;
- enum optype op ;
- enum image_type stencil, image ;
- {
- int ch ;
-
- if (image == P_BLACK) ch = 'X' ;
- else if (image == P_WHITE) ch = 'O' ;
- else return ;
- if (op == RCLR) ch = ' ' ;
- else if (op == RINV) return ;
-
- tc_move(8 + 4 * (((x - BBORDER - PIECE_MARGIN) / CELL_SIZE) & 7),
- 7 + 2 * ((y - BBORDER - PIECE_MARGIN) / CELL_SIZE)) ;
- outc(ch) ;
- }
-
-
- static void
- draw_string(x, y, str, flag) /* Display str at x,y. */
- int x,y, flag ;
- char *str ;
- {
-
- /* If flag is set, then we clear to the end of line, otherwise we
- * display the text str in reverse video.
- */
-
- if (flag)
- {
- tc_move(x, y) ;
- do_clr_eol() ;
- }
- else do_standout() ;
-
- tc_move(x, y) ;
- outstr(str) ;
- if (!flag) do_standend() ;
- }
-
-
- /* Text can be one of three things:
- *
- * (1) Text for "panel" items.
- * (2) Text for "cyclic" items.
- * (3) Other text.
- *
- * First we check to see if this is one of the panel message strings.
- *
- * Next we check if this is a panel button or cycle types.
- *
- * For all other text, we check where it is being displayed against
- * a list of possible values. This is then remapped to the correct
- * row/column number, and displayed.
- */
-
- /*ARGSUSED*/
- void
- draw_text(wtype, x, y, ftype, color, str)
- enum win_type wtype ;
- enum font_type ftype ;
- int x, y, color ;
- char *str ;
- {
- enum panel_type pt ;
- int black, white ;
- int i ;
-
- /* Check if we are inputting a load/save filename. */
-
- if (x == 89 && y == 74)
- {
- draw_string(38, 3, str, TRUE) ; /* File: */
- return ;
- }
- else if (x == 136 && y == 74)
- {
- draw_string(45, 3, str, TRUE) ; /* filename */
- return ;
- }
-
- /* Check for the six panel message types. */
-
- else if (x == 15 && y == 111 && wtype == W_PANEL) /* Black: message. */
- {
- draw_string(othervals[(int) BLACK_PLAYS].column,
- othervals[(int) BLACK_PLAYS].row, str, FALSE) ;
- return ;
- }
- else if (x == 237 && y == 111 && wtype == W_PANEL) /* White: message. */
- {
- draw_string(othervals[(int) WHITE_PLAYS].column,
- othervals[(int) WHITE_PLAYS].row, str, FALSE) ;
- return ;
- }
- else if (x == 15 && y == 195 && wtype == W_PANEL) /* Panel message. */
- {
- if (EQUAL(str, "Use left"))
- STRCPY(str, "Select a letter/number pair for a move") ;
- draw_string(othervals[(int) PANEL_MES].column,
- othervals[(int) PANEL_MES].row, str, TRUE) ;
- return ;
- }
- else if (x == 15 && y == 237) /* Evaluation message. */
- {
- draw_string(othervals[(int) EVAL_MES].column,
- othervals[(int) EVAL_MES].row, str, TRUE) ;
- return ;
- }
- else if (x == 15 && y == 279) /* Score message. */
- {
- if (sscanf(str, "Stones: Black: %d White: %d", &black, &white) == 2)
- SPRINTF(str, "Black (X): %d, White (O): %d", black, white) ;
- draw_string(othervals[(int) SCORE_MES].column,
- othervals[(int) SCORE_MES].row, str, TRUE) ;
- return ;
- }
- else if (x == 237 && y == 279) /* Turn message. */
- {
- draw_string(othervals[(int) TURN_MES].column,
- othervals[(int) TURN_MES].row, str, TRUE) ;
- return ;
- }
-
- /* Check for the two "Time Left:" and two clock values. */
-
- else if (x == 15 && y == 153 && wtype == W_PANEL) /* Black Time Left. */
- {
- draw_string(othervals[(int) BLACK_CLOCK].column,
- othervals[(int) BLACK_CLOCK].row, str, TRUE) ;
- return ;
- }
- else if (x == 237 && y == 153 && wtype == W_PANEL) /* White Time Left. */
- {
- draw_string(othervals[(int) WHITE_CLOCK].column,
- othervals[(int) WHITE_CLOCK].row, str, TRUE) ;
- return ;
- }
-
- else if (x == 105 && y == 153 && wtype == W_PANEL) /* Black clock value. */
- {
- if (!DO_CLOCK) STRCPY(str, " ") ;
- draw_string(othervals[(int) BLACK_CLOCK].column+11,
- othervals[(int) BLACK_CLOCK].row, str, TRUE) ;
- return ;
- }
- else if (x == 327 && y == 153 && wtype == W_PANEL) /* White clock value. */
- {
- if (!DO_CLOCK) STRCPY(str, " ") ;
- draw_string(othervals[(int) WHITE_CLOCK].column+11,
- othervals[(int) WHITE_CLOCK].row, str, TRUE) ;
- return ;
- }
-
- /* Check for the two player strings. */
-
- else if (x == 89 && y == 111 && wtype == W_PANEL) /* Black plays: value. */
- {
- draw_string(ttyvals[(int) BLACK_PLAYS].column,
- ttyvals[(int) BLACK_PLAYS].row, str, TRUE) ;
- return ;
- }
- else if (x == 311 && y == 111 && wtype == W_PANEL) /* White plays: value. */
- {
- draw_string(ttyvals[(int) WHITE_PLAYS].column,
- ttyvals[(int) WHITE_PLAYS].row, str, TRUE) ;
- return ;
- }
-
- /* Check for panel and cyclic items. */
-
- for (i = 0; i < MAXITEMS-13; i++)
- if (EQUAL(str, items[i].text))
- if (ttyvals[i].column != -1)
- {
- if (EQUAL(str, "load")) STRCPY(str, "Load") ;
- else if (EQUAL(str, "moves?")) STRCPY(str, "Moves?") ;
- else if (EQUAL(str, "save")) STRCPY(str, "Save") ;
- else if (EQUAL(str, "show all")) STRCPY(str, "show All") ;
- draw_string(ttyvals[i].column, ttyvals[i].row, str, FALSE) ;
- return ;
- }
- else return ;
-
- /* Other text. */
-
- switch (y)
- {
- case 111 : if (x == 163) pt = BLACK_PLAYS ; /* Black plays. */
- else pt = WHITE_PLAYS ; /* White plays. */
- break ;
- case 153 : if (x == 163) pt = DIFF_CHOICE ; /* Difficulty. */
- else pt = OPT_EVAL ; /* Notes. */
- break ;
- default : return ; /* We're not interested in this piece of text. */
- }
- draw_string(othervals[(int) pt].column, othervals[(int) pt].row,
- str, TRUE) ;
- }
-
-
- static void
- get_event() /* Only events possible are keyboard ones. */
- {
- struct timeval tval ; /* Set to go off once a second. */
- char c ;
- int fd, reply ;
-
- fd = -1 ;
- nextc = IGNORE_EVENT ;
- tc_move(0, 0) ; /* Get that bloody cursor out of the way. */
- tval.tv_usec = 0 ;
- tval.tv_sec = 1 ;
-
- #ifdef NOSELECT
- #ifdef HASPOLL
- POLL(pfd, npfd, -1) ;
- if (pfd[0].revents == POLLIN) fd = KEY_INPUT ;
- else if (pfd[1].revents == POLLIN) fd = COMP_INPUT ;
- else if (pfd[2].revents == POLLIN) fd = SOCK_INPUT ;
- #else
- FPRINTF(stderr, "This situation in not being properly handled yet.\n") ;
- #endif /*HASPOLL*/
- #else
- readmask = fullmask ;
- #ifdef NO_43SELECT
- SELECT(32, &readmask, 0, 0, &tval) ;
- if (readmask && (1 << 0)) fd = KEY_INPUT ;
- else if (readmask && (1 << pipe_io[1][0])) fd = COMP_INPUT ;
- else if (readmask && (1 << socketfd)) fd = SOCK_INPUT ;
- #else
- SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
- if (FD_ISSET(0, &readmask)) fd = KEY_INPUT ;
- else if (FD_ISSET(pipe_io[1][0], &readmask)) fd = COMP_INPUT ;
- else if (FD_ISSET(socketfd, &readmask)) fd = SOCK_INPUT ;
- #endif /*NO_43SELECT*/
- #endif /*NOSELECT*/
-
- switch (fd)
- {
- case KEY_INPUT : READ(0, &c, 1) ;
- cur_ch = c & 0177 ;
- if (cur_ch == 12) nextc = BOARD_REPAINT ;
- else nextc = KEYBOARD ;
- break ;
- case SOCK_INPUT : read_from_sock(socketfd) ; /* Remote human. */
- break ;
- case COMP_INPUT : read_from_reve(pipe_io[1][0]) ; /* Computer. */
- }
- if (cmode != GAME_OVER) update_clock(next_player, FALSE) ;
- }
-
-
- char *
- get_resource(rtype) /* Null routine (currently only X11 and XView). */
- enum res_type rtype ;
- {
- return((char *) NULL) ;
- }
-
-
- /*ARGSUSED*/
- int
- get_strwidth(ftype, str) /* Get width in pixels of string value. */
- enum font_type ftype ;
- char *str ;
- {
- return(8 * strlen(str)) ;
- }
-
-
- void
- init_fonts() /* Open normal and bold fonts. */
- {
- int i ;
-
- for (i = 0; i < MAXFONTS; i++) font_heights[i] = 12 ;
- }
-
-
- /*ARGSUSED*/
- void
- init_graphics(argc, argv)
- int *argc ;
- char *argv[] ;
- {
- }
-
-
- int
- init_ws_type()
- {
- char bp[1024], termtype[MAXLINE] ;
- static char buf[100] ;
- char *area = buf ;
-
- if (getenv("TERM") != NULL) STRCPY(termtype, getenv("TERM")) ;
- if (tgetent(bp, termtype) != 1) return 1 ;
- if ((CL = tgetstr("cl", &area)) == (char *) 0) return 1 ;
- if ((CM = tgetstr("cm", &area)) == (char *) 0) return 1 ;
- if ((CE = tgetstr("ce", &area)) == (char *) 0) return 1 ;
- if ((SO = tgetstr("so", &area)) == (char *) 0) return 1 ;
- if ((SE = tgetstr("se", &area)) == (char *) 0) return 1 ;
-
- gtype = GTTY ; /* Graphics type. */
- move_delta = 5 ;
- props_showing = TRUE ; /* Force choice item sizes to be calculated. */
- return(0) ;
- }
-
-
- static void
- load_colors() /* No colors in the termcap implementation. */
- {
- iscolor = 0 ;
- }
-
-
- void
- load_resources() /* Dummy routine; used with X11 and XView versions. */
- {
- }
-
-
- /*ARGSUSED*/
- void
- lock_screen(state) /* Graphics locking - null routine. */
- enum bltype state ;
- {}
-
-
- void
- make_canvas() /* Null routine, see the make_frame routine. */
- {}
-
-
- /*ARGSUSED*/
- void
- make_frame(argc, argv) /* Create reve window/icon. */
- int argc ;
- char *argv[] ;
- {
- SIGNAL(SIGINT, cleanup) ;
- IOCTL(0, TIOCGETP, &in_old) ; /* Setup standard input. */
- in_new = in_old ;
- in_new.sg_flags |= RAW ;
- in_new.sg_flags &= ~(ECHO | CRMOD) ;
- IOCTL(0, TIOCSETP, &in_new) ;
- setbuf(stdout, (char *) NULL) ;
- pid = fork_child() ;
- }
-
-
- /*ARGSUSED*/
- void
- make_help_window(argc, argv)
- int argc ;
- char *argv[] ;
- {
- }
-
-
- void
- make_icon() /* Null routine - no icon in termcap version. */
- {}
-
-
- void
- make_pieces(width, height)
- int width, height ;
- {
- bborder = BBORDER ;
-
- cell_width = (width - (2 * bborder)) / BOARD_SIZE ;
- cell_height = (height - (2 * bborder)) / BOARD_SIZE ;
-
- pieceXmargin = cell_width / 8 ;
- pieceYmargin = cell_height / 8 ;
- pieceXrad = (cell_width - (2 * pieceXmargin)) / 2 ;
- pieceYrad = (cell_height - (2 * pieceYmargin)) / 2 ;
- }
-
-
- static void
- outc(c) /* Output the next character to the screen. */
- register int c ;
- {
- PUTC(c, stdout) ;
- }
-
-
- static void
- outstr(str)
- char *str ;
- {
- register int i ;
-
- for (i = 0; i < strlen(str); i++) PUTC(str[i], stdout) ;
- }
-
-
- void
- open_reve()
- {
- }
-
-
- void
- process_event() /* Process the next user input. */
- {
- if (nextc == BOARD_REPAINT)
- {
- paint_board() ;
- paint_panel() ;
- nextc = IGNORE_EVENT ;
- }
- }
-
-
- void
- raise_reve()
- {
- }
-
-
- /*ARGSUSED*/
- void
- set_cursor(cursor) /* No cursors in termcap version. */
- enum curtype cursor ;
- {}
-
-
- /*ARGSUSED*/
- void
- set_frame(wtype, showing)
- enum win_type wtype ;
- int showing ;
- {
- if (wtype == W_PROPS) paint_prop_sheet() ;
- }
-
-
- /*ARGSUSED*/
- void
- start_tool(dtype) /* Display screen and start event dispatcher. */
- enum disp_type dtype ;
- {
- paint_all() ;
-
- for (;;)
- {
- get_event() ; /* Get next canvas event. */
- handle_event() ; /* And do the appropriate action. */
- }
- }
-
-
- static void
- tc_move(x, y) /* Move to character position (x, y). */
- int x, y ;
- {
- tputs(tgoto(CM, x, y), 1, outc) ;
- }
-